<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" %> 
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>城市列表</title>
<%@ include file="../commoms/link.txt"%>
<style type="text/css">body{text-align:left;font-size:14px; background:#f9f9f9; font-family:Arial, "宋体" , sans-serif; line-height:200%;}a{text-decoration:none}dd{display:inline-table;margin-right:7px}#clist{width:990px; margin:0 auto;clear:both;overflow:hidden;zoom:1;padding:0 0 20px;}</style>

</head>
<body>

<%@ include file="../commoms/Header.txt"%>
<dl id="clist"></dl>
<script>
	window.onload=function(){
		var result;
		var city;
		var clist=document.getElementById("clist");
		$('#changecity').text(localCity);
		$.ajax({
			url: "./api/cityCode/getProvince.do",
			async: false,//改为同步方式
			type: "POST",
			dataType: "json",
			success: function (courseDT4) {
				result = courseDT4;
			}
			
		});
		for(var i in result){
			clist.innerHTML+=("<dt><span>"+result[i].diming+"</span></dt>");
			$.ajax({
				url: "./api/cityCode/getCities.do ",
				async: false,//改为同步方式
				type: "POST",
				data: {"Province":result[i].daima},
				dataType: "json",
				success: function (courseDT4) {
					city = courseDT4;
				}
			});
			for(var j in city){
				clist.innerHTML+=("<dd ><a href=\"javascript:selectCity("+city[j].daima+",&quot;"+city[j].diming+"&quot;)\">"+city[j].diming+"<a></dd>");
			}
		}
	}

	function setCookie(c_name,value)
	{
		var exdate=new Date()
		document.cookie=c_name+ "=" +escape(value)+";expires=-1";
	}
	function selectCity(id,diming){
		setCookie("localcity",diming);
		setCookie("localcitycode",id);
	
		location.href="./";
		
	}
</script>
</body>
</html>